//
// Created by wenyaxi on 24-10-28.
//

#ifndef LISTNODE_H
#define LISTNODE_H
#include <vector>
#include <base.h>

struct ListNode {
    int val;
    ListNode *next;

    ListNode() : val(0), next(nullptr) {
    }

    ListNode(int x) : val(x), next(nullptr) {
    }

    ListNode(int x, ListNode *next) : val(x), next(next) {
    }

    static ListNode *of(const std::vector<int> &nums);

    friend std::ostream &operator<<(std::ostream &os,ListNode& node) ;
};
#endif //LISTNODE_H